package com.company;

import com.company.service.Worker;

import java.util.ArrayList;

public class Task4 {
    public static void main(String[] args) {
        //todo 4. 创建一个List，在List 中增加三个工人Worker，基本信息如下：
        // 姓名 年龄 工资
        // zhang3 18 3000
        // li4 25 3500
        // wang5 22 3200
        // 2) 在li4 之前插入一个工人，信息为：姓名：zhao6，年龄：24，工资3300
        // 3) 删除wang5 的信息
        // 4) 利用for 循环遍历，打印List 中所有工人的信息
        ArrayList list = new ArrayList();
        Worker worker = new Worker();
        worker.name = "zhang3";
        worker.age = 18;
        worker.wages = "3000";
        list.add(worker);

        Worker worker2 = new Worker();
        worker2.name = "li4";
        worker2.age = 25;
        worker2.wages = "3500";
        list.add(worker2);

        Worker worker3 = new Worker();
        worker3.name = "wang5";
        worker3.age = 22;
        worker3.wages = "3200";
        list.add(worker3);
        System.out.println("原始数据：");
        System.out.println(list);

        Worker worker4 = new Worker();
        worker4.name = "zhao6";
        worker4.age = 24;
        worker4.wages = "3300";
        list.add(1,worker4);
        System.out.println("添加zhao6：");
        System.out.println(list);
        list.remove(3);
        System.out.println("删除wang5");
        System.out.println(list);

    }
}
